/*
 * @Author: your name
 * @Date: 2021-04-26 14:58:28
 * @LastEditTime: 2021-07-05 11:50:13
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \dolphin-data-center-front-end\src\services\employeeDetail.js
 */
import Qs from 'qs'

import {
  PERSONAL_INFO,
  EDU_HISTORY,
  JOB_HISTORY,
  FAMILY_MEMBER,
  ATTACHMENT_LIST,
  attachmentAddOrUpdateflowersApiPath,
  attachmentDelByIdApiPath,
  jobHistoryAddOrUpdateApiPath,
  jobHistoryDelByIdApiPath,
  contactAddOrUpdateApiPath,
  contactDelByIdApiPath,
  eduHistoryAddOrUpdateApiPath,
  eduHistoryDelByIdApiPath,
  userInfoAddOrUpdateApiPath,
  colleagueAddOrUpdateApiPath,
  colleagueDelByIdApiPath,
  contractAddOrUpdateApiPath,
  getProjectListForSelectApiPath,
  bindProjectApiPath,
  bankNumRegIvkApiPath,
} from './api'

import { METHOD, request } from '@/utils/request'

export function bankNumRegIvkApi(params) {
  return request(
    `${bankNumRegIvkApiPath}?cardNo=${params}&cardBinCheck=true`,
    METHOD.GET
  )
}

export function personalInfo(params) {
  return request(PERSONAL_INFO, METHOD.GET, params)
}

export function eduHistory(params) {
  return request(EDU_HISTORY, METHOD.GET, params)
}

export function jobHistory(params) {
  return request(JOB_HISTORY, METHOD.GET, params)
}

export function familyMember(params) {
  return request(FAMILY_MEMBER, METHOD.GET, params)
}

export function attachmentList(params) {
  return request(ATTACHMENT_LIST, METHOD.GET, params)
}

export function attachmentAddOrUpdateflowersApi(params) {
  return request(attachmentAddOrUpdateflowersApiPath, METHOD.POST, params)
}

export function attachmentDelByIdApi(params) {
  return request(`${attachmentDelByIdApiPath}?id=${params}`, METHOD.POST)
}

export function jobHistoryAddOrUpdateApi(params) {
  return request(jobHistoryAddOrUpdateApiPath, METHOD.POST, params)
}

export function jobHistoryDelByIdApi(params) {
  return request(jobHistoryDelByIdApiPath, METHOD.POST, Qs.stringify(params))
}

export function contactAddOrUpdateApi(params) {
  return request(contactAddOrUpdateApiPath, METHOD.POST, params)
}

export function contactDelByIdApi(params) {
  return request(contactDelByIdApiPath, METHOD.POST, params)
}

export function eduHistoryAddOrUpdateApi(params) {
  return request(eduHistoryAddOrUpdateApiPath, METHOD.POST, params)
}

export function eduHistoryDelByIdApi(params) {
  return request(eduHistoryDelByIdApiPath, METHOD.POST, Qs.stringify(params))
}

export function userInfoAddOrUpdateApi(params) {
  return request(userInfoAddOrUpdateApiPath, METHOD.POST, params)
}

export function colleagueAddOrUpdateApi(params) {
  return request(colleagueAddOrUpdateApiPath, METHOD.POST, params)
}

export function colleagueDelByIdApi(params) {
  return request(`${colleagueDelByIdApiPath}?id=${params}`, METHOD.POST)
}

export function contractAddOrUpdateApi(params) {
  return request(contractAddOrUpdateApiPath, METHOD.POST, params)
}

export function getProjectListForSelectApi(params) {
  return request(getProjectListForSelectApiPath, METHOD.GET, params)
}

export function bindProjectApi(id, projectId) {
  return request(
    `${bindProjectApiPath}?employeeId=${id}&projectId=${projectId}`,
    METHOD.POST
  )
}

export default {
  personalInfo,
  eduHistory,
  jobHistory,
  familyMember,
  attachmentList,
  attachmentAddOrUpdateflowersApi,
  attachmentDelByIdApi,
  jobHistoryAddOrUpdateApi,
  jobHistoryDelByIdApi,
  contactAddOrUpdateApi,
  contactDelByIdApi,
  eduHistoryAddOrUpdateApi,
  eduHistoryDelByIdApi,
  userInfoAddOrUpdateApi,
  colleagueAddOrUpdateApi,
  colleagueDelByIdApi,
  contractAddOrUpdateApi,
  getProjectListForSelectApi,
  bindProjectApi,
}
